<?php

class RecipesController extends Controller{

	public function accessRules(){
		return array(
				array('allow',
						'actions'=>array( 'getRecipes' ),
						'users'=>array('*'),
				)
		);
	}
	
	public function filters(){
		return [ 'accessControl' ];
	}
	
	public function actionGetRecipes(){
		$recipes = [ 'recipes' => [
				[ 'recipe' => 'Pollo al curry', 'author' => 'Alejandro', 'date' => '29 Aug 2014' ],
				[ 'recipe' => 'Jamon Bellotero', 'author' => 'Maria', 'date' => '13 Dec 2013' ],
				[ 'recipe' => 'Perro al limon', 'author' => 'Fernando', 'date' => '01 Feb 2011' ],
			]
		];
		
		$this->renderJSON( $recipes );
	}
}